<?php 
namespace app\api\validate;
use think\Validate;
/**
* 
*/
class Enterprise extends Validate
{
	
	protected $rule = [
		'name'=>'require|checkUnique',
	];
	protected $message = [
		'name.require'=>'企业名称必须填写',
		'name.checkUnique'=>'企业名称不能重复'
	];
	protected $scene = [
		'edit'=>[
			'id'=>'require'
		]
	];
	public function checkUnique($value,$rule,$data){
		if(db('enterprise')->where(['name'=>$value,'is_del'=>0])->find()){
			return FALSE;
		}
		return TRUE;
	}
}

?>